<template>
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>用户管理</el-breadcrumb-item>
      <el-breadcrumb-item>用户列表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card>
      <el-row :gutter="20">
        <el-col :span="6" :offset="6">
          <el-input placeholder="请输入内容">
            <el-button
              slot="append"
              icon="el-icon-search"
            ></el-button> </el-input
        ></el-col>
        <el-col :span="6">
          <el-button type="primary">主要按钮</el-button>
        </el-col>
      </el-row>

      <el-table :data="userItem" border stripe>
        <el-table-column type="index" label="id"> </el-table-column>
        <el-table-column label="姓名" prop="username"> </el-table-column>
        <el-table-column label="邮箱" prop="email"> </el-table-column>
        <el-table-column label="电话" prop="mobile"> </el-table-column>
        <el-table-column label="角色" prop="role_name"> </el-table-column>
        <el-table-column label="状态">
          <template slot-scope="scope">
            <el-switch v-model="scope.row.mg_state"> </el-switch>
          </template>
        </el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope"
            >{{ scope.row }}
            <el-button type="primary" icon="el-icon-edit"></el-button>
            <el-button type="primary" icon="el-icon-share"></el-button>
            <el-button type="primary" icon="el-icon-delete"></el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      userList: {
        query: "",
        pagenum: 1,
        pagesize: 2,
      },
      userItem: [],
    };
  },
  methods: {
    async querBtn() {
      const { data: res } = await this.$http.get("users", {
        params: this.userList,
      });
      console.log(res.data.users);
      this.userItem = res.data.users;
    },
  },
  computed: {
    user() {},
  },
  mounted() {
    this.querBtn();
  },
};
</script>

<style scoped></style>
<style lang="scss" scoped>
.el-table {
  margin-top: 10px;
}
</style>
